// import fetch from "../config/fetch"
// export const test = data => fetch("/admin/test",data,"POST")
import { baseUrl } from "../config/env"
// console.log(baseUrl)
import vueResource from "vue-resource"
// console.log(vueResource)
import Vue from "vue"
Vue.use(vueResource)
Vue.http.options.xhr = { withCredentials: true};
export const login = data => Vue.http.post(`${baseUrl}/admin/login`,data,{emulateJSON:true,credentials:true})
export const userCount = data => Vue.http.get(`${baseUrl}/statis/user/${data}/count`)
export const adminCount = data => Vue.http.get(`${baseUrl}/statis/admin/${data}/count`)
export const orderCount = data => Vue.http.get(`${baseUrl}/statis/order/${data}/count`)
export const allShop = data => Vue.http.get(`${baseUrl}/business/getAllShop`,data)
export const addShop = data => Vue.http.get(`${baseUrl}/business/addShop`,data)
export const allFood = data => Vue.http.get(`${baseUrl}/business/getAllFood`,data)
export const addFood = data => Vue.http.get(`${baseUrl}/business/addFood`,data)
export const getAllCategory = data => Vue.http.get(`${baseUrl}/business/getAllCategory`)
export const findOne = data => Vue.http.post(`${baseUrl}/admin/findOne`,data,{emulateJSON:true})
export const update = data => Vue.http.post(`${baseUrl}/admin/update`,data,{emulateJSON:true})
export const updateShop = data => Vue.http.post(`${baseUrl}/business/updateShop`,data)
export const addCategory = data => Vue.http.get(`${baseUrl}/business/addCategory`)
export const getFoodCategory = data => Vue.http.get(`${baseUrl}/business/getFoodCategory`,data)
export const addCategory1 = data => Vue.http.get(`${baseUrl}/business/addCategory1`,data)
export const updateFood = data => Vue.http.get(`${baseUrl}/business/updateFood`,data)
export const deleteFood = data => Vue.http.get(`${baseUrl}/business/deleteFood`,data)
export const deleteShop = data => Vue.http.get(`${baseUrl}/business/deleteShop`,data)



